<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    {{date | fmtDate}}
    <div :title="msg | fmtText">你好过滤器</div>
  </div>
  <script>
    // 全局注册过滤器
    Vue.filter('fmtDate', (data) => {
      return new Date(data).toLocaleString()
    })
    let vm = new Vue({
      el: "#app",
      data: {
        date: 1629777276567,
        msg: 'hello'
      },
      methods: {

      },
      created() {

      },
      filters: {
        fmtText(data) {
          return data.toUpperCase()
        }
      }
    })
  </script>
</body>

</html>